#!/bin/bash

java="*.java";
java_l=0;

xhtml="*.xhtml";
xhtml_l=0;

scss="*.scss";
scss_l=0;

xml="*.xml";
xml_l=0;

total_l=0;



#Count java lines of code
for i in `find . -name $java`; do
	java_l=$((java_l + `cat $i | sed '/^\s*#/d;/^\s*\*\/$/d;/^\s*\/\//d;/^\s*\/\*/d;/^\s*<!-/d;/^\s*\*/d'| wc -l`)) ;
done ;

#count xhtml lines of code
for i in `find . -name $xhtml`; do
	xhtml_l=$((xhtml_l + `cat $i | sed '/^\s*#/d;/^\s*\*\/$/d;/^\s*\/\//d;/^\s*\/\*/d;/^\s*<!-/d;/^\s*\*/d'| wc -l`)) ;
done ;

#count scss lines of code
for i in `find . -name $scss`; do
	scss_l=$((scss_l + `cat $i | sed '/^\s*#/d;/^\s*\*\/$/d;/^\s*\/\//d;/^\s*\/\*/d;/^\s*<!-/d;/^\s*\*/d'| wc -l`)) ;
done ;

#count xml lines of code
for i in `find . -name $xml`; do
	xml_l=$((xml_l + `cat $i | sed '/^\s*#/d;/^\s*\*\/$/d;/^\s*\/\//d;/^\s*\/\*/d;/^\s*<!-/d;/^\s*\*/d'| wc -l`)) ;
done ;


echo -n "Java LOC: "; echo $java_l;
echo -n "Xhtml LOC: "; echo $xhtml_l;
echo -n "Scss LOC: "; echo $scss_l;
echo -n "Xml LOC: "; echo $xml_l;

total_l=$((java_l+xhtml_l+scss_l+xml_l));
echo -n "Total LOC: "; echo $total_l;

